package com.itxiaosu.pojo.base;

import com.itxiaosu.strategy.DiscountStrategy;

public abstract class Fruit {
    protected String name;
    protected double price;
    protected DiscountStrategy discountStrategy;

    public Fruit(String name, double price, DiscountStrategy discountStrategy) {
        this.name = name;
        this.price = price;
        this.discountStrategy = discountStrategy;
    }

    public String getName() {
        return name;
    }

    public double getPrice() {
        return price;
    }

    public void setDiscountStrategy(DiscountStrategy discountStrategy) {
        this.discountStrategy = discountStrategy;
    }

    // 计算水果总价的抽象方法
    public abstract double calculateTotal(int quantity);


}
